import sys
import uvicorn
from  terminalApp import  ter

if __name__ == "__main__":
    terCode = "ter_zj_01"
    dataUrl = "http://hh.hhdata.cn:31563/zn/getTerData"
    postUrl = "http://hh.hhdata.cn:31563/zn/varPost"
    if len(sys.argv) >1 :
        terCode = sys.argv[1]
    if len(sys.argv) >2 :
        dataUrl = sys.argv[2]
    if len(sys.argv) >3 :
        postUrl = sys.argv[3]

    ter.terCode = terCode
    ter.dataUrl = dataUrl
    ter.postUrl = postUrl
    ter.apiPort = 18002
    if len(sys.argv)>1:
        ter.terCode = sys.argv[1]
    if len(sys.argv)>2:
        ter.apiPort = int(sys.argv[2])
    if len(sys.argv)>3:
        ter.dataUrl = sys.argv[3]
    ter.start()
    uvicorn.run(
        "terminalApp:app" ,
        host="0.0.0.0",
        port= ter.apiPort
    )

